//
//  ZTMacros.h
//  Pods
//
//  Created by 武得亮 on 2021/3/12.
//

#ifndef ZTMacros_h
#define ZTMacros_h

#import <UIKit/UIKit.h>


/** 用户信息宏*/
#define ZTPrivateUserInfoKey @"ZTPrivateUserInfoKey"

//获取系统对象
#define WEAK_SELF __weak typeof(self) weakSelf = self

#define YXAppDelegate ((AppDelegate *)[[UIApplication sharedApplication] delegate])

#define kApplication        [UIApplication sharedApplication]
#define kAppWindow          [[[UIApplication sharedApplication] delegate] window]
#define kAppDelegate        [AppDelegate shareAppDelegate]
#define kRootViewController [UIApplication sharedApplication].delegate.window.rootViewController
#define kUserDefaults       [NSUserDefaults standardUserDefaults]
#define kNotificationCenter [NSNotificationCenter defaultCenter]
#define kFileManager        [NSFileManager defaultManager]

//获取屏幕宽高
#define KScreenWidth ([[UIScreen mainScreen] bounds].size.width)
#define KScreenHeight [[UIScreen mainScreen] bounds].size.height
#define kScreen_Bounds [UIScreen mainScreen].bounds
#define getRectNavAndStatusHight  self.navigationController.navigationBar.frame.size.height+[[UIApplication sharedApplication] statusBarFrame].size.height

#define SafeAreaTopHeight ((KScreenHeight == 812.0 || KScreenHeight == 896.0) ? 88 : 64)

#define Iphone6ScaleWidth KScreenWidth/375.0
#define Iphone6ScaleHeight KScreenHeight/667.0
//根据ip6的屏幕来拉伸
#define kRealValue(with) ((with)*(KScreenWidth/375.0f))

//强弱引用
#define kWeakSelf(type)  __weak typeof(type) weak##type = type;
#define kStrongSelf(type) __strong typeof(type) type = weak##type;

//View 圆角和加边框
#define ViewBorderRadius(View, Radius, Width, Color)\
\
[View.layer setCornerRadius:(Radius)];\
[View.layer setMasksToBounds:YES];\
[View.layer setBorderWidth:(Width)];\
[View.layer setBorderColor:[Color CGColor]]

// View 圆角
#define ViewRadius(View, Radius)\
\
[View.layer setCornerRadius:(Radius)];\
[View.layer setMasksToBounds:YES]

//property 属性快速声明 别用宏定义了，使用代码块+快捷键实现吧

///IOS 版本判断
#define IOSAVAILABLEVERSION(version) ([[UIDevice currentDevice] availableVersion:version] < 0)

#define IOS10_OR_LATER ([[[UIDevice currentDevice] systemVersion] floatValue] >= 10.0)
#define IOS9_OR_LATER ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9.0)
#define IOS8_OR_LATER ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
#define IOS7_OR_LATER ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)
#define IOS11_OR_LATER ([[[UIDevice currentDevice] systemVersion] floatValue] < 11.0)



// 当前系统版本
#define CurrentSystemVersion [[UIDevice currentDevice].systemVersion doubleValue]
//当前语言
#define CurrentLanguage (［NSLocale preferredLanguages] objectAtIndex:0])

//-------------------打印日志-------------------------
//DEBUG  模式下打印日志,当前行
#ifdef DEBUG
#define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
#define DLog(...)
#endif

//拼接字符串
#define NSStringFormat(format,...) [NSString stringWithFormat:format,##__VA_ARGS__]


#define RGB(R, G, B)    [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:1.0]
#define TopSpacing 40.0f
#define BottomSpacing 40.0f
#define LeftSpacing 20.0f
#define RightSpacing  20.0f
#define DELAYEXECUTE(delayTime,func) (dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayTime * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{func;}))
#define DistanceFromTopGuiden(view) (view.frame.origin.y + view.frame.size.height)
#define DistanceFromLeftGuiden(view) (view.frame.origin.x + view.frame.size.width)
#define ViewOrigin(view)   (view.frame.origin)
#define ViewSize(view)  (view.frame.size)
#define ScreenSize [UIScreen mainScreen].bounds.size


#define LSYNoteNotification @"LSYNoteNotification"
#define LSYThemeNotification @"LSYThemeNotification"
#define LSYEditingNotification @"LSYEditingNotification"
#define LSYEndEditNotification @"LSYEndEditNotification"

#define ZTRefreshMeetingDetail @"ZTRefreshMeetingDetail"

#define MinFontSize 11.0f
#define MaxFontSize 20.0f
#define kDocuments NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject



//颜色
#define KClearColor [UIColor clearColor]
#define KWhiteColor [UIColor whiteColor]
#define KBlackColor [UIColor blackColor]
#define KGrayColor [UIColor grayColor]
#define KGray2Color [UIColor lightGrayColor]
#define KBlueColor [UIColor blueColor]
#define KRedColor [UIColor redColor]
#define kRandomColor    KRGBColor(arc4random_uniform(256)/255.0,arc4random_uniform(256)/255.0,arc4random_uniform(256)/255.0)        //随机色生成

//字体
#define BOLDSYSTEMFONT(FONTSIZE)[UIFont boldSystemFontOfSize:FONTSIZE]
#define SYSTEMFONT(FONTSIZE)    [UIFont systemFontOfSize:FONTSIZE]
#define FONT(NAME, FONTSIZE)    [UIFont fontWithName:(NAME) size:(FONTSIZE)]


//定义UIImage对象
#define ImageWithFile(_pointer) [UIImage imageWithContentsOfFile:([[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@@%dx", _pointer, (int)[UIScreen mainScreen].nativeScale] ofType:@"png"])]
#define IMAGE_NAMED(name) [UIImage imageNamed:name]

//数据验证
#define StrValid(f) (f!=nil && [f isKindOfClass:[NSString class]] && ![f isEqualToString:@""])
#define SafeStr(f) (StrValid(f) ? f:@"")
#define HasString(str,eky) ([str rangeOfString:key].location!=NSNotFound)

#define ValidStr(f) StrValid(f)
#define ValidDict(f) (f!=nil && [f isKindOfClass:[NSDictionary class]])
#define ValidArray(f) (f!=nil && [f isKindOfClass:[NSArray class]] && [f count]>0)
#define ValidNum(f) (f!=nil && [f isKindOfClass:[NSNumber class]])
#define ValidClass(f,cls) (f!=nil && [f isKindOfClass:[cls class]])
#define ValidData(f) (f!=nil && [f isKindOfClass:[NSData class]])

//获取一段时间间隔
#define kStartTime CFAbsoluteTime start = CFAbsoluteTimeGetCurrent();
#define kEndTime  NSLog(@"Time: %f", CFAbsoluteTimeGetCurrent() - start)
//打印当前方法名
#define ITTDPRINTMETHODNAME() ITTDPRINT(@"%s", __PRETTY_FUNCTION__)

//GCD
#define kDISPATCH_ASYNC_BLOCK(block) dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), block)
#define kDISPATCH_MAIN_BLOCK(block) dispatch_async(dispatch_get_main_queue(),block)
//GCD - 一次性执行
#define kDISPATCH_ONCE_BLOCK(onceBlock) static dispatch_once_t onceToken; dispatch_once(&onceToken, onceBlock);

//发送通知
#define KPostNotification(name,obj) [[NSNotificationCenter defaultCenter] postNotificationName:name object:obj];

//单例化一个类
#define SINGLETON_FOR_HEADER(className) \
\
+ (className *)shared##className;

#define SINGLETON_FOR_CLASS(className) \
\
+ (className *)shared##className { \
static className *shared##className = nil; \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
shared##className = [[self alloc] init]; \
}); \
return shared##className; \
}


#define DISPATCH_MAIN_THREAD(mainQueueBlock) dispatch_async(dispatch_get_main_queue(), mainQueueBlock);
//GCD - 开启异步线程
#define DISPATCH_GLOBAL_QUEUE_DEFAULT(globalQueueBlock) dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), globalQueueBlocl);

// MainScreen height&width
#define Main_Screen_Height      [[UIScreen mainScreen] bounds].size.height
#define Main_Screen_Width       [[UIScreen mainScreen] bounds].size.width

//判断设备是否是iPhone X以上设备
#define  kDevice_Is_iPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)
//#define  kDevice_Is_iPhoneX Is_iPhoneXS() ? Is_iPhoneXS() : NO

//判断是否是XS MAX
static inline BOOL Is_iPhoneXS() {
    if (@available (iOS 11.0, *)) {
        return [UIApplication sharedApplication].delegate.window.safeAreaInsets.bottom >0;
    }
    return NO;
}


//static inline BOOL kDevice_Is_iPhoneX {
//    if (@available (iOS 11.0, *)) {
//        return [UIApplication sharedApplication].delegate.window.SafeAreaInsets.bottom >0;
//    }
//    return NO;
//}

#define SafeAreaBottomHeight (Is_iPhoneXS() ? 34 : 0)
#define kAdaptFontX     0.075*([IMSetUserDefaultTool getFontSizeCoefficient]-2)+1
#import <UIKit/UIKit.h>
//导航栏status高度
#define statusHeight [UIApplication sharedApplication].statusBarFrame.size.height

#define HEIGHT_TABBAR       49      // 就是chatBox的高度

#define kUserDefaults       [NSUserDefaults standardUserDefaults]
#define kFileManager        [NSFileManager defaultManager]

#define zStatusBarHeight [UIApplication sharedApplication].statusBarFrame.size.height
#define zNavBarHeight 44.0

#define ZT_AppDelegate  ((AppDelegate *)[[UIApplication sharedApplication] delegate])
#define DDLog(xx, ...)  NSLog(@"行数:%s(%d): " xx, __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)


#define kScreenWithRatio (Main_Screen_Width/375.f)
#define kScreenHeightRatio (Main_Screen_Height/667.f)

#define AdaptedWidthValue(x)  x * (Main_Screen_Width/375.f)
#define AdaptedHeightValue(x) (x * kScreenHeightRatio)


#pragma mark - ——————— 用户相关 ————————
//登录状态改变通知
#define KNotificationLoginStateChange @"loginStateChange"

//自动登录成功
#define KNotificationAutoLoginSuccess @"KNotificationAutoLoginSuccess"

//被踢下线
#define KNotificationOnKick @"KNotificationOnKick"

//用户信息缓存 名称
#define KUserCacheName @"KUserCacheName"

//用户model缓存
#define KUserModelCache @"KUserModelCache"

//CA认证
#define CAMsspId @"CAMsspId"

//日程右上角列表引导图
#define dulist226 @"dulist226"

//日程列表引导图
#define schedule226 @"schedule230"

//创建日程时引导图
#define newCreateMemo226 @"newCreateMemo226"

//门户引导图
#define portal_work @"portal_work"

//导航返回字
#define BackBarButtonItem(string) UIBarButtonItem *returnButtonItem = [[UIBarButtonItem alloc] init];\
returnButtonItem.title = string;\
self.navigationItem.backBarButtonItem = returnButtonItem;\


#pragma mark - ——————— 网络状态相关 ————————

//网络状态变化
#define KNotificationNetWorkStateChange @"KNotificationNetWorkStateChange"


#define IOS11 ([[[UIDevice currentDevice] systemVersion] doubleValue] >=11.0 ? YES : NO)
//大于12系统
#define IOS12 ([[[UIDevice currentDevice] systemVersion] doubleValue] >=12.0 ? YES : NO)

//大于13系统
#define IOS14 ([[[UIDevice currentDevice] systemVersion] doubleValue] >=14 ? YES : NO)


//密聊key
#define expandChatForValue @"value"
#define expandChatForKey @"attribute1"

//通知的消息用户
#define NeedSpecialTreatment @"NeedSpecialTreatment"//当包含这个key的时候使用自定义cell
#define zttzuser @"zttzuser"//通知公告
#define tzvideouser @"tzvideouser"//视频会议
#define ztxzsuser @"ztxzsuser"//小助手
#define dbtzuser @"dbtzuser"//事项通知
#define ywmsuser @"ywmsuser"//预约公务用车
#define notesuser @"notesuser"//笔记
#define zttShareDocument @"zttShareDocument" //共享文档

#define ChangePrivateNetwork @"ChangePrivateNetwork"//专网下切换

#define isChangeContacts @"isChangeContacts"//是否刷新通讯录

#define refreshTextView_Text @"refreshTextView_Text" //语音键盘的通知key
#define refreshNotesTextView_Text @"refreshNotesTextView_Text" //笔记语音键盘的通知key
#define refreshMeetingTextView_Text @"refreshMeetingTextView_Text" //会议语音键盘的通知key


//pc端
#define expandChatName @"attr_name"
#define expandChatAvatar @"attr_avatar"
#define expandChatTime @"attr_time"
#define expandChatTimeInterval @"time"//时间戳
//字体大小
#define WebfontSize @"WebfontSize"

#define expandChatRoomId @"attr_roomid"
#define expandChatCreateUser @"attr_room_createUser"

//会话列表key
#define converseChatForValue @"converseValue"
#define converseChatForKey @"converseAttribute1"

//判断普通消息
#define ZChatConversation @"ZChatConversation"
//个人消息是否免打扰 软测问题
#define isConversationDisturb @"isConversationDisturb"
//消息是否置顶
#define isConversationTop @"isConversationTop"


#define hasUnreadWithSecretMessage @"hasUnreadWithSecretMessage"

//置顶聊天
#define kGroupTopGroupIdsKey @"kGroupTopGroupIdsKey"

//添加好友
#define addFriendNotification @"addFriendNotification"
//同意好友请求
#define addFriendNotification1 @"addFriendNotification1"
//刷新collview
#define refreshCollNotification @"refreshCollNotification"
//刷新DU列表
#define refreshDUListNotification @"refreshDUListNotification"
#define DEMO_CALL 1

/** 未读密信消息 */
#define haveSecretMessageUnread @"haveSecretMessageUnread"


/** 切换环境通知 */
#define ZChangeAppEnvironment @"ZChangeAppEnvironment"

/** 从其他应用转发文件 */
#define kNotifyTransfortFile @"kNotifyTransfortFile"

/** 新建工作组通知 */
#define kNotifyCreateWorkTeamNotificationName @"kNotifyCreateWorkTeamNotificationName"

/** 群主删除工作组通知 */
#define kNotifyDelegateWorkTeamNotificationName @"kNotifyDelegateWorkTeamNotificationName"

/** 工作组改名通知 */
#define kNotifyChangeNotificationName @"kNotifyChangeNotificationName"

/** 切换部门刷新应急接口 */
#define kNotifyRefreshEmergencyNotificationName @"kNotifyRefreshEmergencyNotificationName"

#define ZGroupMemberChangeNotificationCenter @"ZGroupMemberChangeNotificationCenter"

#define ZHiddenVoiceKeyboardNotificationCenter @"ZHiddenVoiceKeyboard"

/** 添加成员通知 */
#define kNotifyWorkTeamAddMemberNotificationName @"kNotifyWorkTeamAddMemberNotificationName"

/** 改变群主通知 */
#define kNotifyWorkTeamChanegeUserCreaterNotificationName @"kNotifyWorkTeamChanegeUserCreaterNotificationName"

/** 收到被邀请时通知 */
#define kNotifyWorkTeamRefreshMemberNotificationName @"kNotifyWorkTeamRefreshMemberNotificationName"

/** 调起单人音视频通话 */
#define kNotifyCallVideoAndVoiceNotificationName @"kNotifyCallVideoAndVoiceNotificationName"

/** 部门切换 */
#define kNotifyRefreshPortal @"kNotifyRefreshPortal"
/** 刷新事项、日程详情 */
#define kNotifyRefreshDuAndSched @"kNotifyRefreshDuAndSched"
#define kNotifySwitchDepartment @"kNotifySwitchDepartment"
//是否是刚登录
#define kNotifyRefreshPortalFirst @"kNotifyRefreshPortalFirst"
//通知去设置手势密码
#define isSettingLockWord @"isSettingLockWord"

//通知手势密码设置完成
#define isSettingLockWordOver @"isSettingLockWordOver"

#define rgba(r,g,b,a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]

#define kScreenW [UIScreen mainScreen].bounds.size.width
#define kScreenH [UIScreen mainScreen].bounds.size.height

/**
 *  单个圆背景色
 */
#define CircleBackgroundColor [UIColor clearColor]

/**
 *  解锁背景色
 */
#define CircleViewBackgroundColor rgba(13,52,89,1)

/**
 *  普通状态下外空心圆颜色
 */
#define CircleStateNormalOutsideColor rgba(34,178,246,1) //[UIColor themeColor]//rgba(241,241,241,1)

/**
 *  选中状态下外空心圆颜色
 */
#define CircleStateSelectedOutsideColor [UIColor themeColor]//rgba(34,178,246,1)

/**
 *  错误状态下外空心圆颜色
 */
#define CircleStateErrorOutsideColor rgba(254,82,92,1)

/**
 *  普通状态下内实心圆颜色
 */
#define CircleStateNormalInsideColor [UIColor clearColor]

/**
 *  选中状态下内实心圆颜色
 */
#define CircleStateSelectedInsideColor [UIColor themeColor]//rgba(34,178,246,1)

/**
 *  错误状态内实心圆颜色
 */
#define CircleStateErrorInsideColor rgba(254,82,92,1)

/**
 *  普通状态下三角形颜色
 */
#define CircleStateNormalTrangleColor [UIColor clearColor]

/**
 *  选中状态下三角形颜色
 */
#define CircleStateSelectedTrangleColor rgba(34,178,246,1)

/**
 *  错误状态三角形颜色
 */
#define CircleStateErrorTrangleColor rgba(254,82,92,1)

/**
 *  三角形边长
 */
#define kTrangleLength 10.0f

/**
 *  普通时连线颜色
 */
#define CircleConnectLineNormalColor [UIColor themeColor]//rgba(34,178,246,1)

/**
 *  错误时连线颜色
 */
#define CircleConnectLineErrorColor rgba(254,82,92,1)

/**
 *  连线宽度
 */
#define CircleConnectLineWidth 1.0f

/**
 *  单个圆的半径
 */
#define CircleRadius 33.0f

/**
 *  单个圆的圆心
 */
#define CircleCenter CGPointMake(CircleRadius, CircleRadius)

/**
 *  空心圆圆环宽度
 */
#define CircleEdgeWidth 1.0f

/**
 *  九宫格展示infoView 单个圆的半径
 */
#define CircleInfoRadius 5

/**
 *  内部实心圆占空心圆的比例系数
 */
#define CircleRadio 0.4

/**
 *  整个解锁View居中时，距离屏幕左边和右边的距离
 */
#define CircleViewEdgeMargin 30.0f

/**
 *  整个解锁View的Center.y值 在当前屏幕的3/5位置
 */
#define CircleViewCenterY kScreenH * 3/5 - 63

/**
 *  连接的圆最少的个数
 */
#define CircleSetCountLeast 4

/**
 *  错误状态下回显的时间
 */
#define kdisplayTime 1.0f

/**
 *  最终的手势密码存储key
 */
#define gestureFinalSaveKey @"gestureFinalSaveKey"

//隐藏window界面
#define hidewindowPlayerNotificationCenter @"hidewindowPlayerNotificationCenter"

/**
 *  最终的手势密码存储keyNotificationName
 */
#define gestureFinalSaveKeyNotificationName @"gestureFinalSaveKeyNotificationName"


/**
 *  2.1.6版本是否是第一次启动key
 */
#define isFirstGestureFinalKey @"isFirstGestureFinalKey"

/**
 *  第一个手势密码存储key
 */
#define gestureOneSaveKey @"gestureOneSaveKey"

/**
 *  普通状态下文字提示的颜色
 */
#define textColorNormalState [UIColor norTextColor]//rgba(241,241,241,1)

/**
 *  警告状态下文字提示的颜色
 */
#define textColorWarningState rgba(254,82,92,1)

/**
 *  绘制解锁界面准备好时，提示文字
 */
#define gestureTextBeforeSet @"绘制解锁图案"

/**
 *  设置时，连线个数少，提示文字
 */
#define gestureTextConnectLess [NSString stringWithFormat:@"最少连接%d个点，请重新输入", CircleSetCountLeast]

/**
 *  确认图案，提示再次绘制
 */
#define gestureTextDrawAgain @"再次绘制解锁图案"

/**
 *  再次绘制不一致，提示文字
 */
#define gestureTextDrawAgainError @"与上次绘制不一致，请重新绘制"

/**
 *  设置成功
 */
#define gestureTextSetSuccess @"设置成功"

/**
 *  请输入原手势密码
 */
#define gestureTextOldGesture @"请输入手势密码"

/**
 *  密码错误
 */
#define gestureTextGestureVerifyError @"密码错误"

#pragma mark- 会议室人数已满
#define VOICE_VIDEO_MEETING_TYPE_OVERFLOW @"VOICE_VIDEO_MEETING_TYPE_OVERFLOW"

#define VOICE_VIDEO_MEETING_INCONFERENCE  @"VOICE_VIDEO_MEETING_INCONFERENCE"

//接收到web发送音视频的指令关闭接听界面
#define VOICE_VIDEO_MEETING_DISSMISSRECEIVE  @"VOICE_VIDEO_MEETING_DISSMISSRECEIVE"
//接收到广播会议踢人消息时的指令
#define RADIO_MEETING_DISSMISSRECEIVE  @"RADIO_MEETING_DISSMISSRECEIVE"

//检测网络
#define MONITOR_NETWORKING @"MONITOR_NETWORKING"

#define NETWORKING_LOSE @"NETWORKING_LOSE"

// 上导航高度
#define kNAVIGATIONBARHEIGHT 64.f

// 动画时间
#define kANIMATIONTIMEINTERVAL 0.2f

// 获取验证码时间间隔(秒)
#define DEFAULT_SMSCODE_TIME_COUNT 60

#define HTTPS @"https"


#define UserPicture @"userPicture"
//是否有应急、通知发送权限
#define isSendNitification @"isSendNitification"

#define APPDeviceToken @"token"

//视频会议地址
#define APPMeetingService @"APPMeetingService"
//视频会议端口
#define APPMeetingPort @"APPMeetingPort"

//视频会议KeyCode
#define APPKeyCode @"3025495AEE146DA3864AB81BAAF79A3E"
//和CA冲突 暂时删除
//#define UserName @"userName"
#define EmployeeOrgBaseUrl @"EmployeeOrgBaseUrl"

#define USERQR @"USERQR"

#define PASSWORD @"password"

#define SECRETPASSWORD @"secretpassword"

#define USERTELEPHONE @"userTelePhone"//办公电话

#define USEREMAIL @"userEmail"//邮箱

#define USERPDID @"pdId"//人员部门主键

#define MSGLIST @"msgList"//人员所有部门

#define USERORGID @"orgId"//人员部门主键

#define COMPANYID @"companyId"//人员部门主键

#define ACCOUNT @"account"


//新建任务通知key
#define changguikey @"changgui"

#define tianjiafujiankey @"tianjiafujian"

#define yuyinanniukey @"yuyinanniu"

#define tianjiafujiantkey @"tianjiafujiantkey"

#define changguikey2 @"changguikey2"

//笔记键盘通知 附件
#define notes_fileKey @"notes_fileKey"
//笔记键盘通知 图片
#define notes_picKey @"notes_picKey"

//frist启动
#define fristCreateAppKey @"fristCreateAppKey"

#define fristCreateAppValue @"fristCreateAppValue"

#define addFristCreateAppKey @"addFristCreateAppKey1"

#define addFristCreateAppValue @"addFristCreateAppValue1"

//显示消息界面展示图
#define fristChatPageKey231 @"fristChatPageKey231"
//显示文件传输助手界面展示图
#define fristfiletransferassistantPageKey @"fristfiletransferassistantPageKey"
//显示通讯录界面展示图
#define fristConversationPageKey @"fristConversationPageKey"

//显示我的界面展示图
#define fristMyPageKey @"fristMyPageKey"

//显示日程看板界面展示图
#define fristrichengkanbanPageKey @"fristrichengkanbanPageKey"

//显示事项详情界面展示图
#define fristTaskDeatilPageKey @"fristTaskDeatilPageKey"

//显示应用通知界面展示图
#define fristappNotCenterPageKey @"fristappNotCenterPageKey"

//显示日程界面展示图
#define fristworkRichengPageKey @"fristworkRichengPageKey"

//文件传输助手
#define filetransferassistant @"filetransferassistant"

//手势密码数组
#define KlockPassWord @"lockPassWord"

/** 邮箱账号 密码**/
#define EmailPicture @"emailPicture"

#define EmailName @"emailName"

//查看代码的执行时间

#define TICK   NSDate *startTime = [NSDate date]
#define TOCK   NSLog(@"Time: %f", -[startTime timeIntervalSinceNow])


#define CREATE_SHARED_MANAGER(CLASS_NAME) \
+ (instancetype)sharedManager { \
static CLASS_NAME *_instance; \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
_instance = [[CLASS_NAME alloc] init]; \
}); \
\
return _instance; \
}


#ifdef DEBUG  // debug
#define DLog(format, ...) NSLog((@"%s [Line %d] " format), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);

#include <assert.h>
#include <stdbool.h>
#include <sys/sysctl.h>
#include <sys/types.h>
#include <unistd.h>

__attribute__((unused)) static bool AmIBeingDebugged(void) {
    int junk;
    int mib[4];
    struct kinfo_proc info;
    size_t size;
    
    info.kp_proc.p_flag = 0;
    mib[0] = CTL_KERN;
    mib[1] = KERN_PROC;
    mib[2] = KERN_PROC_PID;
    mib[3] = getpid();
    
    size = sizeof(info);
    junk = sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, NULL, 0);
    assert(junk == 0);
    
    return ((info.kp_proc.p_flag & P_TRACED) != 0);
}

#define DCHECK(condition) \
if (!(condition)) { \
if (AmIBeingDebugged()) { \
DLog(@"trigger break point."); \
kill (getpid(), SIGSTOP); \
} else { \
DLog(@"could not break into debugger."); \
} \
}

#define DCHECK_OP(name, op, val1, val2) \
DCHECK(val1 op val2)

#define DCHECK_EQ(val1, val2) DCHECK_OP(EQ, ==, val1, val2)
#define DCHECK_NE(val1, val2) DCHECK_OP(NE, !=, val1, val2)
#define DCHECK_LE(val1, val2) DCHECK_OP(LE, <=, val1, val2)
#define DCHECK_LT(val1, val2) DCHECK_OP(LT, < , val1, val2)
#define DCHECK_GE(val1, val2) DCHECK_OP(GE, >=, val1, val2)
#define DCHECK_GT(val1, val2) DCHECK_OP(GT, > , val1, val2)
#define NOTREACHED() DCHECK(NO)

#else // release

#define DLog(...)
#define DCHECK(...)
#define DCHECK_EQ(...)
#define DCHECK_NE(...)
#define DCHECK_LE(...)
#define DCHECK_LT(...)
#define DCHECK_GE(...)
#define DCHECK_GT(...)
#define NOTREACHED()

#endif  // end

#define ZTFONT(__f) [UIFont systemFontOfSize:__f]

#define RGBCOLOR(__r, __g, __b) [UIColor colorWithRed:(__r) / 255. green:(__g) / 255. blue:(__b) / 255. alpha:1.]
#define RGBACOLOR(__r, __g, __b, __a) [UIColor colorWithRed:(__r) / 255. green:(__g) / 255. blue:(__b) / 255. alpha:(__a)]
#define HEXCOLOR(__h) RGBCOLOR(((__h >> 16) & 0xFF), ((__h >> 8) & 0xFF), (__h & 0xFF))
#define HEXACOLOR(__h, __a) RGBACOLOR(((__h >> 16) & 0xFF), ((__h >> 8) & 0xFF), (__h & 0xFF), __a)
#define HEXCOLOR_STR(__str) HEXCOLOR(strtoul([__str UTF8String], 0, 16))

#define iPhone4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(320*UI_SCREEN_SCALE, 480*UI_SCREEN_SCALE), [[UIScreen mainScreen] currentMode].size) : NO)

#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(320*UI_SCREEN_SCALE, 568*UI_SCREEN_SCALE), [[UIScreen mainScreen] currentMode].size) : NO)

#define iPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(375*UI_SCREEN_SCALE, 667*UI_SCREEN_SCALE), [[UIScreen mainScreen] currentMode].size) : NO)

#define iPhone6Plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(414*UI_SCREEN_SCALE, 736*UI_SCREEN_SCALE), [[UIScreen mainScreen] currentMode].size) : NO)

#define iPad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)

#define MakeSafe(str) (str = (str == nil) ? @"" : str)
#define SafeString(str) ((str == nil) ? @"" : str)

//系统标识
#define IOS8 ([[[UIDevice currentDevice] systemVersion] doubleValue] >=8.0 ? YES : NO)
#define IOS9 ([[[UIDevice currentDevice] systemVersion] doubleValue] >=9.0 ? YES : NO)

#define IOS11 ([[[UIDevice currentDevice] systemVersion] doubleValue] >=11.0 ? YES : NO)

#ifndef weakify
#if __has_feature(objc_arc)

#define weakify(x) \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wshadow\"") \
autoreleasepool{} __weak __typeof__(x) __weak_##x##__ = x; \
_Pragma("clang diagnostic pop")

#else

#define weakify(x) \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wshadow\"") \
autoreleasepool{} __block __typeof__(x) __block_##x##__ = x; \
_Pragma("clang diagnostic pop")

#endif  // end arc
#endif  // end weakify

#ifndef strongify
#if __has_feature(objc_arc)

#define strongify(x) \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wshadow\"") \
try{} @finally{} __typeof__(x) x = __weak_##x##__; \
_Pragma("clang diagnostic pop")

#else

#define strongify(x) \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wshadow\"") \
try{} @finally{} __typeof__(x) x = __block_##x##__; \
_Pragma("clang diagnostic pop")

#define kDiscvoerVideoPath @"Download/Video"  // video子路径
#define kChatVideoPath @"Chat/Video"  // video子路径
#define kVideoType @".mp4"        // video类型


#define kChatRecoderPath @"Chat/Recoder"
#define kRecodAmrType @".amr"

#endif  // end arc
#endif  // end strongify
#endif /* Macros_h */
